package android_design_mode.chapter14_iterator;

import java.util.ArrayList;
import java.util.List;

public class ConcreteAggregate<T> implements Aggregate<T> {
    private List<T> list = new ArrayList<T>();


    @Override
    public void add(T data) {
        list.add(data);
    }

    @Override
    public void remove(T data) {
        list.remove(data);
    }

    @Override
    public Iterator<T> iterator() {
        return new ConcreteIterator<>(list);
    }
}
